package fos

import scala.util.parsing.input.Positional

/** Abstract Syntax Trees for terms. */
abstract class Term extends Positional

case class Variable(val name: String) extends Term {
  override def toString = name
  def isInFreeVarsOf(t: Term) = Untyped.isInFreeVarsOf(this, t)
}

case class Abstraction(x: Variable, t: Term) extends Term {
 override val toString = "(\\%s.%s)".format(x,t)
}

case class Application(t1: Term, t2: Term) extends Term {
  override val toString = t2 match{
    case _: Application => "%s (%s)".format(t1,t2)
    case _ => "%s %s".format(t1,t2)
  }
}